import Vue from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import locale from 'element-ui/lib/locale/lang/zh-CN' // lang i18n

import '@/styles/index.scss' // global css
// set ElementUI lang to EN
Vue.use(ElementUI, { locale })

import App from './App'
import store from './store'
import router from './router'

import axios from 'axios' // 引入axios

import qs from 'qs'
Vue.prototype.$axios = axios // 全局注册，使用方法为:this.$axios
Vue.prototype.qs = qs // 全局注册，使用方法为:this.qs
axios.defaults.headers.common['Authorization'] = sessionStorage.getItem('Authorization')
axios.defaults.timeout = 15000
// 引入echarts：
import echarts from 'echarts/lib/echarts'
Vue.prototype.$echarts = echarts

// 引入日期格式化：
import moment from 'moment'
Vue.prototype.moment = moment

import '@/icons' // icon
import '@/permission' // permission control

import * as filters from './filters'
Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})

Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
